home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
comm
/
dep309.zip
/
DEPARC.EXE
/
SCRIPTS.EXE
/
MICKEY.DSL
< prev
next >
Wrap
Text File
|
1993-07-14
|
7KB
|
183 lines
SCRIPT Mickey;
(* Deputy DSL Demonstration Script Version 1.3 *)
(* Copyright 1992 Michael Spalter & SEG *)
(* This script makes use of the following DSL commands:
Functions Returning Booleans Procedures
---------------------------- ----------
Fexists(filename) FDelete(filename)
DCD FRename(oldname,newname)
FEOF(filehandle) Write(string)
KeyPressed WrLn
ClrScr
Hangup
Functions Returning Integers WriteStatus(String)
---------------------------- Alarm
FileSize(filename) ForeGnd(colour)
ScriptTime BackGnd(colour)
Pos(searchstring,bigstring) OpenLog(filename)
Length(stringvar) CloseLog
ABS() WhereY GoToXY(x,y)
Menu(....) StatusLine(Boolean)
INC(integervar[,number])
Functions Returning Strings StrToInt(string,intvar)
--------------------------- Read(stringvar)
Time
Date
Caps(StringVar) *)
(* First, define the variables used in the script *)
VAR YourName:String[18];
Happiness:Integer;
Value:Integer;
FileLine:String[78];
ValueString:String[15];
LineCount:Integer;
FileBytes:Integer; (* This is an enclosed comment *)
People:String[20]; (* Comments can be placed anywhere *)
FileHandle:Integer; (* and are ignored by Deputy's Compiler *)
(* Note: Apostrophes and Inverted commas are identical in function
It's best to use one type. In this script we have tried to use
apostrophes only,but where we need to write an apostrophe
to the screen, we use the inverted commas instead. *)
(* Now the actual main script body starts *)
BEGIN
StatusLine(TRUE);
ClrScr;
WriteStatus(' Welcome to the Deputy Demonstration script !');
StatusLine(TRUE);
Alarm();
OpenLog('Test.LOG');
GoToXY(20,10);
Write(' Hold on a few seconds......');
WHILE ScriptTime()<3 DO END;
WrLn;
ClrScr;
WriteStatus('');
GoToXY(0,5);
Write("\t The date is ",Date,", and the time is ",Time); WrLn;
Write('\t This is a sample script using the Deputy'); WrLn;
Write('\t script language. It is designed to show '); WrLn;
Write('\t the use of as many commands as possible.'); WrLn;
FileBytes:=FSize('DEPUTY.EXE');
Write('\t The Deputy program is ',Filebytes,' bytes long,'); WrLn;
Write('\t and this script has been running ',ScriptTime(),' Secs.');
WrLn; WrLn;
Write('\t Who is with you (their names please) ? ');
Read(People); WrLn;
IF POS('JIM',Caps(People))<>-1 THEN
Write('\t I see that Jim is with you !'); WrLn;
ELSE
Write('\t I see that Jim is NOT with you with you !'); WrLn;
END;
Write('\t By the Way, that string was ',Length(People),' bytes');
WrLn; WrLn;
Write('\t Please enter a negative number: ');
Read(ValueString); WrLn;
StrToInt(ValueString,Value); (* Convert it to an Integer first *)
Write('\t Okay. Without the sign, it equals ',ABS(Value)); WrLn;
Write('\t The Cursor is now at ',WhereX,',',WhereY()); WrLn;
WrLn;
Write("\t Please type in your first name: ");
Read(YourName); WrLn;
Write("\t I'm now going write your name to a file....");
Filehandle := FCreate('TestFile.TXT');
FWrite(FileHandle,YourName);
FClose(FileHandle);
Write('Done ! '); WrLn; WrLn;
IF NOT Fexists('TestFile.TXT') THEN
Write("\t Arrgghh ! File didn't Write properly !"); WrLn;
ELSE
Write("\t That seemed to work. Now I'll read it back.....");
YourName:= ''; (* Clear the String *)
FileHandle := FOpen('TestFile.TXT');
FRead(FileHandle,YourName);
FClose(FileHandle);
Write('Done !'); WrLn;
Write("\t According to the file, your name is ",YourName,".");
WrLn;
Write("\t I'll just delete that file now."); WrLn;
FDelete('TestFile.TXT');
END;
WrLn;
Write('\t Press any key to go on......');
WHILE NOT Keypressed() DO END;
WrLn;
ClrScr();
REPEAT Value:=RdKey() UNTIL NOT Keypressed(); (* Clear Kbd Buffer *)
Happiness := 1 + Menu(24,3,30,"How happy are you ?",
"1 - Extremely happy ",
"2 - Very Happy ",
"3 - Quite Happy ",
"4 - Content",
"5 - Nonchalent",
"6 - A little sad",
"7 - Upset",
"8 - Completely distraught",28);
GoToXY(0,2);
CASE Happiness OF
1: Write("\t So, you're extremely happy - Good !");|
2: Write("\t You're very happy apparently");|
3: Write("\t You are quite happy - that's nice");|
4: Write("\t You are content - barely happy :-(");|
ELSE
Write("\t You are not happy at all - what a shame!");
END;
WrLn; WrLn;
IF NOT DCD THEN
Write('\t You are currently not online.'); WrLn;
ELSE
Write("\t You are currenly online, I'll just hangup"); WrLn;
Hangup;
END;
CloseLog;
FRename('Test.LOG','NewTest.LOG');
WrLn;
Write("\t Press a key to see a directory of your disc....");
WHILE NOT Keypressed() DO END;
REPEAT Value:=RdKey() UNTIL NOT KeyPressed(); (* Clear Kbd Buffer *)
DOSCMD('CLS',FALSE);
DOSCMD('DIR /w',TRUE);
ClrScr;
GoToXY(0,2);
If Fexists('NewTest.LOG') THEN
Write("\t Press any key for a review.......");
WHILE NOT Keypressed() DO END;
Happiness := RdKey();
WrLn; WrLn;
FileHandle:=FOpen('NewTest.LOG');
LineCount:= 0;
Repeat
FRead(FileHandle,FileLine);
ForeGnd(White);
Write('Review [ ');
ForeGnd(Yellow);
Write(FileLine);
Foregnd(White);
GoToXY(79,WhereY()); Write(']'); WrLn;
INC(LineCount);
If LineCount MOD 10 = 0 THEN
WrLn;
Write(' [ Press any key to continue ]');
WHILE NOT Keypressed() DO END;
While Keypressed() DO RdKey() END;
WrLn; WrLn;
END;
UNTIL FEOF(FileHandle);
WrLn;
FClose(FileHandle);
FDelete('NewTest.LOG');
Write(' [ End of Review (Length: ',LineCount,' Lines) ]');
END;
WrLn; WrLn;
Write('That is the end of the script !'); WrLn; WrLn;
END Mickey;